package com.woniuxy.lab.woniu_lab_boss.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.woniuxy.lab.woniu_lab_boss.common.Result;
import com.woniuxy.lab.woniu_lab_boss.service.OrderService;
import com.woniuxy.lab.woniu_lab_boss.service.dto.HealthDto;
import com.woniuxy.lab.woniu_lab_boss.service.dto.OrderDto;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;

/**
 * <p>
 * 消费记录表 前端控制器
 * </p>
 *
 * @author Silas
 * @since 2023-03-15
 */
@RestController
@RequestMapping("/order")
@Slf4j
@Api(tags = "[G]消费记录相关接口")
public class OrderController {
    @Resource
    private OrderService orderService;

    /**
     * 查询VIP充值的记录
     *
     * @param page
     * @param size
     * @return
     */
    @ApiOperation("80 查看VIP的购买记录")
    @GetMapping("/vipOrder")
    public Result<IPage<OrderDto>> checkVIPOrder(@ApiParam(value = "第几页") @Min(value = 1,message="页码必须大于1") Integer page,
                                                 @ApiParam(value = "每页条数") @Min(value = 1,message="每页展示数必须大于1") @Max(value = 10,message = "每页展示数不能大于10") Integer size) {
        log.info("查询成为VIP的消费记录");
        IPage<OrderDto> orderDtoIPage = orderService.queryVip(page, size);

        return Result.success(200, "查询VIP充值记录成功", orderDtoIPage);
    }
}

